<script type="text/javascript" >
     function set_size(){
        var size = jQuery("#result").height();
        size = size+50;
        jQuery(".pp_content").attr('style','height:'+size+'px');
    }
    jQuery(".galleryVideo a[rel^='prettyPhoto']").prettyPhoto({
            theme:'facebook',
            default_height:100,
            keyboard_shortcuts: false
        });
    stFacebookToolbox.load_tooltip();
    stFacebookToolbox.on_submitform('#settingForm');
    jQuery("#tabs ul li").each(function(){
        if(jQuery(this).children().attr('action') == 'gallery_app' || jQuery(this).children().attr('action') == 'coupon')
            jQuery(this).hide();
        if(jQuery(this).children().attr('action') == 'home_applications')
            jQuery(this).attr('class','current');
        });
</script>
<div class="w100p bgl">
    <div class="w100p bgr p5b">
        <?php if($functions->appPermission($config, 'applications')){?>
                <ul class="menu_right">
                     <li>
                        <a style="cursor: pointer;top:0px;" onclick="stFacebookToolboxcustom.loadPage('add_new_form');" class="button add-new-h2 anchor">
                       <b>Add new form</b>
                    </a>
                    </li>
                   
                </ul>
            <div id="accordion">
            <?php $stt=1;foreach($result as $row):?>
            <h3><a href="#" style="font-size: 10pt;"><?php echo $row->form_name;?> <?php if($row->page_id != ''){?>( Facebook page: <?php echo $wpdb->get_var("SELECT pagename FROM st_likepluginfbpagelist WHERE pageid=".$row->page_id);?> )<?php } ?></a></h3>
            <div style="height:82.6px;">
                <ul class="fm">
                    	<li><a href="javascript:void(0);" onclick="stFacebookToolboxcustom.loadPage('view_form_entries&form_id=<?php echo $row->form_id;?>')"><img alt="" src="<?php echo $config['imagesUrl'];?>n_entries_32.gif"><p>Entries (<font color="red"><?php echo $wpdb->get_var("SELECT COUNT(*) FROM st_ap_form_value WHERE form_id = ".$row->form_id) ;?></font>)</p></a></li>
                        <li><a href="javascript:void(0);" onclick="stFacebookToolboxcustom.loadPage('edit_form&id=<?php echo $row->form_id;?>')"><img alt="" src="<?php echo $config['imagesUrl'];?>n_edit_form_32.gif"><p>Edit form</p></a></li>
                        <li><a href="javascript:void(0);" onclick="jQuery.prettyPhoto.loadPage('embed_code&id=<?php echo $row->form_id;?>',null,null,function(){set_size();});"><img alt="" src="<?php echo $config['imagesUrl'];?>n_embed_code_32.gif"><p>Embedded code</p></a></li>
                        <li><a href="javascript:void(0);"  onclick="stFacebookToolboxcustom.loadPage('edit_form&id=<?php echo $row->form_id;?>&view=1')"><img alt="" src="<?php echo $config['imagesUrl'];?>properties.png"><p>Properties</p></a></li>
                        <li><a href="javascript:void(0);"  onclick="stFacebookToolboxcustom.loadPage('edit_form&id=<?php echo $row->form_id;?>&style=1')"><img alt="" src="<?php echo $config['imagesUrl'];?>style.png"><p>Form style</p></a></li>
                        <li><a href="<?php echo get_bloginfo('url');?>/view/?id=<?php echo $row->form_id;?>&key=<?php echo $row->secrect_code;;?>" target="_blank"><img alt="" src="<?php echo $config['imagesUrl'];?>n_view_form_32.gif"><p>View form</p></a></li>
                       <?php if($row->page_id != ''){?>
                        <li><a href="<?php echo $wpdb->get_var("SELECT pageurl FROM st_likepluginfbpagelist WHERE pageid = ".$row->page_id).'?sk=app_135432083196429';?>" target="_blank"><img alt="" src="<?php echo $config['imagesUrl'];?>facebook.png"><p>Show on Facebook</p></a></li>
                        <?php } ?>
                        <li><a href="javascript:void(0);" onclick="stFacebookToolboxcustom.delete_form(<?php echo $row->form_id;?>);" ><img alt="" src="<?php echo $config['imagesUrl'];?>delete.png"><p>Delete form</p></a></li>
                       
                    </ul>
                

            </div>
            <?php
            if($row->form_id == $default_id){
                $default = intval($stt)-1;
            }
            $stt++;
            endforeach;
            ?>
    </div>
        <?php }else{?>
        <br />
        <center>You don't have permission to access this page</center>
        <br />
        <?php }?>
    </div>
</div>
<style>
    .ui-widget-content {
        background:none;
    }
</style>
<input type="hidden" id="default" value="<?php echo $default;?>" />
<?php if($redirect == 1){?>
<script>
     jQuery( "#accordion" ).accordion({
                            autoHeight: false,
                            navigation: true,
                            collapsible: true
                        }); 
</script>
<?php }?>